<template>
	<view>
		<view class="tabs">
			<up-tabs :list="list1" @click="click"></up-tabs>
		</view>
		<post />

	</view>
</template>

<script setup>
	import {
		reactive,
		onMounted,
		ref
	} from 'vue';
	import post from '../../components/post/post.vue'
	import userStore from '../../store/modules/user'
	import {
		GetUserPost,
	} from '../../apis/user'
	const useStore = userStore();
	// 创建响应式数据  
	const list1 = reactive([{
			name: '全部',
		},
		{
			name: '原创'
		},
		{
			name: '文章'
		},
		{
			name: '图片'
		}

	]);

	let postdata = ref()
	let page = ref('1')
	let limit = ref('10')

	onMounted(() => {
		GetPostData()

	})
	const GetPostData = async function() {
		const data = {
			user_id: useStore.user_id,
			page: page.value,
			limit: limit.value
		}
		try {
			const res = await GetUserPost(data);
			postdata.value = res.data
			console.log(postdata.value);
		} catch (error) {
			// 错误处理逻辑
			console.error('An error occurred while executing Captcha function:', error);
		}
	}

	// 定义方法  
	function click(item) {
		console.log('item', item);
	}
</script>
<style lang="scss">
	.tabs {
		margin: 10upx 100upx 10upx 150upx;
	}
</style>